import turtle

def koch(size, n):
    if n == 0:
        turtle.fd(size)
    else:
        for angle in [0, 60, -120, 60]:
            turtle.left(angle)
            koch(size / 3, n - 1)

def main():
    turtle.setup(900, 700)
    turtle.speed(0)
    turtle.penup()

    turtle.goto(-150, 100)

    turtle.pendown()
    turtle.pensize(2)
    turtle.color("blue")
    turtle.bgcolor("white")

    level = 3

    koch(300, level)
    turtle.right(120)
    koch(300, level)
    turtle.right(120)
    koch(300, level)

    turtle.hideturtle()
    turtle.done()

if __name__ == "__main__":
    main()